#!/usr/bin/env python

import os
import sys

from tools.gpick import *

Import('*')
local_env = env.Clone()

if not local_env.GetOption('clean'):
	local_env.ParseConfig('pkg-config --cflags --libs $GTK_PC')
	local_env.ParseConfig('pkg-config --cflags --libs $LUA_PC')
	if local_env.has_key('UNIQUE_PC'):
		local_env.ParseConfig('pkg-config --libs $UNIQUE_PC')
	if local_env.has_key('DBUSGLIB_PC'):
		local_env.ParseConfig('pkg-config --libs $DBUSGLIB_PC')
	if local_env['ENABLE_NLS']:
		local_env.Append(
			CPPDEFINES = ['ENABLE_NLS'],
			)

sources = local_env.Glob('*.cpp') + local_env.Glob('dynv/*.cpp') + local_env.Glob('tools/*.cpp') + local_env.Glob('transformation/*.cpp')

objects = []
objects.append(SConscript(['version/SConscript'], exports='env'))
objects.append(SConscript(['unique/SConscript'], exports='env'))
objects.append(SConscript(['gtk/SConscript'], exports='env'))
objects.append(SConscript(['layout/SConscript'], exports='env'))
objects.append(SConscript(['internationalisation/SConscript'], exports='env'))
objects.append(SConscript(['dbus/SConscript'], exports='env'))

parser_objects, generated_files = SConscript(['cssparser/SConscript'], exports='env')
objects.append(parser_objects)

if local_env['BUILD_TARGET'] == 'win32':
	local_env.Append(LINKFLAGS = '-mwindows')
	objects.append(SConscript(['winres/SConscript'], exports='env'))
elif local_env['BUILD_TARGET'] == 'linux2':
	local_env.Append(LIBS=['rt'])

local_env.Append(LIBS=['expat'])

executable = local_env.Program(
	'gpick',
	source = [sources, objects])

Return('executable', 'generated_files')

